package Klassen;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class SudokuConverter {

	public static void getSudoku(String filename, int row) throws IOException {
		BufferedReader bf = new BufferedReader(new FileReader(filename));
		String line;
		File file;
		FileWriter fw;
		int n = 0;
		while ((line = bf.readLine()) != null) {
			if (n == row) {
				file = new File("test.csv");
				fw = new FileWriter(file);
				for (int i = 0; i < 9; i++) {
					for (int t = 0; t < 9; t++) {
						fw.write("\"" + line.charAt(t) + "\"");
						if (t < 8) {
							fw.write(",");
						}

					}
					fw.write(System.getProperty("line.separator"));
					line = line.substring(9);
				}
				fw.flush();
				fw.close();
				break;
			}
			n++;
		}
		bf.close();

	}
}
